package com.bsy.common.dialog.listener

import android.view.Gravity
import android.view.LayoutInflater
import androidx.fragment.app.FragmentActivity
import com.bsy.framework.base.BaseDialog
import com.bsy.framework.base.BaseDialog.AnimStyle.TOAST
import com.bsy.framework.base.BaseDialogFragment
import com.bsy.framework.databinding.WidgetTipsToastBinding
import com.bsy.framework.manager.AppManager

/**
 *
 */
class ToastDialog {
    class Builder(
        activity: FragmentActivity, private var r: Runnable,
    ) : BaseDialogFragment.Builder<Builder>(activity) {
        private val mBinding: WidgetTipsToastBinding = WidgetTipsToastBinding.inflate(LayoutInflater.from(activity))

        init {
            setWidth((AppManager.getScreenWidthPx() * 0.9).toInt())
            setContentView(mBinding.root)
            postDelayed(r, 3000)
            setAnimStyle(TOAST)
            setGravity(Gravity.CENTER)

        }

        override fun create(): BaseDialog {
            return super.create()
        }
    }
}